package com.qdxwx.data.mapper.order;

import com.qdxwx.common.page.PageRequest;
import com.qdxwx.models.order.OrderDetail;
import com.qdxwx.models.order.OrderDetailQuery;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Qdx NetSchool Platform
 * @author qdxwx
 * @updateTime 2022/5/25
 * @description
 */
@Repository
public interface OrderDetailMapper {

    /**
     * 添加OrderDetail
     * @param orderDetail 要添加的OrderDetail
     * @return id
     */
    int createOrderDetail(OrderDetail orderDetail);

    /**
     * 批量添加OrderDetail
     * @return id
     */
    void addBatchOrderDetail(List<OrderDetail> orderDetailList);

    /**
     * 根据id删除一个OrderDetail
     * @param id 要删除的id
     */
    void deleteOrderDetailById(Long id);

    /**
     * 修改OrderDetail
     * @param orderDetail 要修改的OrderDetail
     */
    int updateOrderDetail(OrderDetail orderDetail);

    /**
     * 根据id获取单个OrderDetail对象
     * @param id 要查询的id
     * @return OrderDetail
     */
    OrderDetail selectOrderDetailById(long id);
    /**
     * 更新流水状态为成功，网银回调用
     * @param orderDetail
     */
    int updateOrderDetailStatusSuccess(OrderDetail orderDetail);
    /**
     * 查询明天有课程过期的用户信息
     */
    List<OrderDetail> selectTimeOverOrder();

    List<OrderDetail> selectList(@Param("e") OrderDetailQuery query, @Param("page") PageRequest page);

    long count(@Param("e") OrderDetailQuery query);

    OrderDetail selectByOrderId(int orderId);

    Long sumPrice(@Param("e") OrderDetailQuery query);

    long countByCourse(@Param("e") OrderDetailQuery query);

    List<OrderDetail> selectListByCourse(@Param("e") OrderDetailQuery query, @Param("page") PageRequest page);

    int updateCombine(long userId1, long userId2);
}